/**
 * 系统登录前清除 token
 */
function getCookie (key) {
    var arr; var reg = RegExp('(^| )' + key + '=([^;]+)(;|$)')
    arr = document.cookie.match(reg)
    if (arr) {
        return decodeURIComponent(arr[2])
    } else {
        return null
    }
}

export default function () {
    var key = 'token'
    var date = new Date()
    date.setTime(date.getTime() - 1)
    var delValue = getCookie(key)
    if (delValue) {
        document.cookie = key + '=' + delValue + ';expires=' + date.toGMTString()
    }
}
